<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
            "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>SplitContainer Demo</title>
     <style type="text/css">
            @import "../dojo-release-1.0.0/dijit/themes/tundra/tundra.css";
            @import "../dojo-release-1.0.0/dojo/resources/dojo.css";
            @import "../dojo-release-1.0.0/dojo/1.0.0/dojox/grid/_grid/tundraGrid.css";
        </style>
        <script type="text/javascript" src="../dojo-release-1.0.0/dojo/dojo.js"
                djConfig="parseOnLoad: true, isDebug: true"></script>
 <script>
     
            dojo.require("dojo.data.ItemFileWriteStore");
            dojo.require("dijit.layout.SplitContainer");
            dojo.require("dijit.layout.ContentPane");
            dojo.require("dijit.Tree");
            dojo.require("dojo.parser");
            dojo.require("dijit._tree.dndSource");
            dojo.require("dijit.layout.TabContainer");
            dojo.require("dijit.form.Button");
                dojo.require("dojox.grid.Grid");
                dojo.require("dojox.grid._data.model");
         
</script>
<script type="text/javascript" src="../js/soapclient.js">
        </script>
        <script type="text/javascript">
         
         var data =new Array();
         var poptarts ={ label:'name',identifier:'eId',items:data};
         var popStore = new dojo.data.ItemFileWriteStore({data: poptarts});
         
         var placeDatas ={ label:'placeName',identifier:'placeName',items:data};
         var placeStore = new dojo.data.ItemFileWriteStore({data: placeDatas});
         function init(){
         
             //添加区域结点
                var url = "http://localhost:8080/logistics-ws/services/BasicManageService";
                var pl = new SOAPClientParameters();
                //pl.add('eType','区域') ;
                pl.add('eType','quyu') ;
                SOAPClient.invoke(url, "getEnumerationByType", pl, false,  function GetEnu_callBack(ul, soapResponse){
                    ul=ul.out;
                     var pInfo = {
					parent: null,		
					attribute: "children"	
				};
                    for(var i = 0; i < ul.length; i++){		
                                 popStore.newItem({name: ul[i].fieldName,type:ul[i].enumerationType ,eId:ul[i].id}, pInfo);
                            }
                        });
                       
                      
            //添加省份结点
            var chitem;
            var chdata =new Array();
            var _tree=dijit.byId("tree");
            var childrenArray1=_tree.getChildren();
            
            for (var i=0; i<childrenArray1.length; i++){//begin	
                var p2 = new SOAPClientParameters();
                
                var chNode =childrenArray1[i];
                chitem=chNode.item;
                var p2Info = {	parent: chitem,		
				attribute: "children"	
			    };
			    
                p2.add('parentType',chitem.eId) ;
                SOAPClient.invoke(url, "getEnumerationByParentId", p2 ,false,  function GetEnu_callBack(ul1, soapResponse){  
                    ul1=ul1.out;
                    for(var ii = 0; ii < ul1.length; ii++){	
                    	popStore.newItem({name: ul1[ii].fieldName,type:ul1[ii].enumerationType ,eId:ul1[ii].id}, p2Info);
                        }
                   });
                }//end
                
                
               
           
                 
                 
                 //添加城区结点
             dojo.connect(dijit.byId("tree"), "_expandNode", function(node){
              
                       //var node = message.node;
                       var ch2node=node.getChildren();
                       for (var i=0; i<ch2node.length; i++){	//BEGIN
                       alert(ch2node[i].getChildren().length);
                       if(ch2node[i].getChildren().length==0){
                         var ch2item =ch2node[i].item;
                         var p3 = new SOAPClientParameters();
                         var p3Info = {
                                        parent: ch2item,		
					attribute: "children"	
				     };
			var _tree=dijit.byId("tree");
                        var identity = _tree.store.getIdentity(ch2item);
                        p3.add('parentType',identity) ;
                        SOAPClient.invoke(url, "getEnumerationByParentId", p3 ,false,  function GetEnu_callBack(ul2, soapResponse){  
                            ul2=ul2.out;
                            for(var j = 0; j < ul2.length; j++){		
                                    popStore.newItem( {name: ul2[j].fieldName,type:ul2[j].enumerationType ,eId:ul2[j].id}, p3Info);
                        }});
                        }
                      }//END
             	 
            });
            
            
            
             dojo.connect(dijit.byId("tree"), "onClick", function(item,node){
                    var identity = _tree.store.getIdentity(item);
                    //  placeStore=
            });
             
            
           }//END INIT
            
           dojo.addOnLoad(init);
           
           //place View
            var view1 = {
                cells: [
                   [
                 {name: 'placeName', field: "placeName"},
                 {name: 'postCode', width: "25em", field: "postCode"},
                  {name: 'province', width: "25em", field: "province"}
                  ],
                   [
                 {name: 'remark', colSpan:"3", field: "remark"}
                   ]
                ]
             };
             
           var layout = [ view1 ];
           
           
           
           
           
           
             
</script>
</head>
<body class="tundra">
       
	
	 <div dojoType="dijit.layout.SplitContainer"
                orientation="horizontal"
                sizerWidth="7"
                activeSizing="true"
                style="border: 1px solid #bfbfbf; width: 1260px; height: 840px;">
		
		
                <div dojoType="dijit.layout.ContentPane" id="treePane"  sizeMin="20" sizeShare="20"  onDownloadEnd="end" onLoad="myonDownloadEnd" >
                     <script>
                      var myonDownloadEnd=function(e){
                         // alert("ffff");
               /* for (var i=0; i<childrenArray1.length; i++){
                 var chNode =childrenArray1[i];
                    chNode.expand();}*/
            
            };
              var end=function(e){
         //   alert("end");
              
            };
            
            
            </script>
                         <div id="tree"  class="container" dojoType="dijit.Tree"  store="popStore" labelAttr="name"  childrenAttr="children"  ></div> 
                </div>
                
                <div dojoType="dijit.layout.ContentPane" sizeMin="50" sizeShare="50">

   <div id="mainTabContainer" dojoType="dijit.layout.TabContainer"
        style="width:500px;height:100px">
      <div id="LittleRed" dojoType="dijit.layout.ContentPane" title="地点" selected="true" >
      
      
      
           <!--div dojoType="dojo.data.ItemFileWriteStore"  id="placeStore" data="placeDatas">        </div-->
           <div dojoType="dojox.grid.data.DojoData" jsId="model" rowsPerPage="20" store="placeStore" query="{ placeName: '*' }">  </div>
           <div id="grid" dojoType="dojox.Grid" model="model" structure="layout"></div>
        
        
        
        
        
           
      </div>
      
      
      
      
      <div id="HanselGretel" dojoType="dijit.layout.ContentPane"
           title="路线" closable="true" >
           输入查询条件：
      </div>
      
</div>

                       
                </div>
        </div>
</body></html>
